package com.lc.recovery.ui.activity.recoverymine;

import android.os.Bundle;
import android.widget.TextView;

import com.lc.recovery.R;
import com.lc.recovery.app.AppActivity;
import com.lc.recovery.other.AppConfig;
import com.lc.recovery.ui.dialog.UpdateDialog;
import com.lc.recovery.util.SystemUtil;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * author : Android 轮子哥
 * github : https://github.com/getActivity/AndroidProject
 * time   : 2018/10/18
 * desc   : 关于界面
 */
public final class AboutActivity extends AppActivity {


    @BindView(R.id.tv_version)
    TextView tvVersion;
    @BindView(R.id.tv_gongsi)
    TextView tvGongsi;

    @Override
    protected int getLayoutId() {
        return R.layout.about_activity;
    }

    @Override
    protected void initView() {

    }

    @Override
    protected void initData() {

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
        userAgreements();
    }

    private void userAgreements() {
               tvVersion.setText("当前版本号:"+ SystemUtil.getAppVersionName(this));
    }

    @OnClick(R.id.sb_setting_about)
    public void onClick() {
        // 本地的版本码和服务器的进行比较
        if (20 > AppConfig.getVersionCode()) {
            new UpdateDialog.Builder(this)
                    .setVersionName("2.0")
                    .setForceUpdate(false)
                    .setUpdateLog("修复Bug\n优化用户体验")
                    .setDownloadUrl("https://down.qq.com/qqweb/QQ_1/android_apk/Android_8.5.0.5025_537066738.apk")
                    .setFileMd5("560017dc94e8f9b65f4ca997c7feb326")
                    .show();
        } else {
            toast(R.string.update_no_update);
        }
    }
}